package top.shiyiri.shops.controller;

import com.alibaba.fastjson.JSONObject;
import top.shiyiri.shops.bean.SexCount;
import top.shiyiri.shops.service.SexCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Aunean
 * @date 2021/12/21
 */
@Controller
public class SexCountController {

    @Autowired
    private SexCountService service;

    @RequestMapping("/findSexCount")
    @ResponseBody
    public String findSexCount() {

        List<SexCount> list = service.findSexCount();

        //把list集合转换成json字符串格式
        String str = JSONObject.toJSONString(list);
//        System.out.println(str);
        return str;
    }

}
